<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateAssetsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        Schema::create('assets', function(Blueprint $table)
		{
			$table->integer('id', true)->comment('主键');
			$table->string('spid', 40)->default('')->index('spid_2')->comment('SP 编号');
			$table->string('asset_type', 20)->default('')->comment('媒资类型');
			$table->string('spasset_id', 50)->default('')->comment('SP 媒资 ID');
			$table->string('spassetkit_id', 50)->nullable()->comment('SP 媒资包 ID');
			$table->string('title', 100)->default('')->comment('媒资名/标题');
			$table->string('subtitle', 100)->nullable()->comment('媒资副标题');
			$table->string('short_desc', 200)->nullable()->comment('媒资简介');
			$table->text('long_desc', 65535)->nullable()->comment('简介');
			$table->string('vcat_id', 20)->nullable()->comment('更多属性字段：电影，电视剧，综艺');
			$table->string('pid', 50)->default('0')->comment('父媒资ID');
			$table->string('subvcat_id', 100)->nullable()->comment('媒资子分类 如: 动作片，战争片 多个以,分隔');
			$table->timestamps();
			$table->integer('inject_datetime')->nullable()->default(0)->comment('注入时间');
			$table->string('directors', 100)->nullable()->comment('导演');
			$table->string('actors', 100)->nullable()->comment('演员');
			$table->string('vlang', 50)->nullable()->comment('语言');
			$table->string('serials', 20)->nullable()->comment('总集数');
			$table->string('sp_file_id', 50)->nullable()->comment('SP文件ID');
			$table->string('file_url', 200)->nullable()->comment('媒体文件URL地址');
			$table->string('duration', 20)->nullable()->comment('节目时长,电影单集系列可录入，以秒为单位  int');
			$table->string('vformat', 20)->nullable()->comment('文件格式，默认为1，1 TS，2 3GP，3 flv，4 MP4，5 wmv，6 mp3');
			$table->string('tags')->nullable()->comment('关键字');
			$table->string('resolutions', 20)->nullable()->comment('默认标清，1 low低清，2 std标清，3 hd 高清，4 超清，5 4k');
			$table->string('vbitate', 20)->nullable()->comment('码率	单位为kbps');
			$table->string('mediatype', 20)->nullable()->comment('文件编码格式	默认H264，1 H264，2 MPEG4，3 AVS，4 MPEG2，5 MP3，6 WMV');
			$table->string('pic0', 200)->nullable()->comment('大图');
			$table->string('pic1', 200)->nullable()->comment('中图');
			$table->string('pic2', 200)->nullable()->comment('小图');
			$table->string('pic3', 200)->nullable()->comment('竖图');
			$table->string('pic4', 200)->nullable()->comment('横图');
			$table->string('pic5', 200)->nullable()->comment('方图');
			$table->string('pinyin', 100)->nullable()->comment('拼音索引');
			$table->integer('score')->default(0)->comment('评分');
			$table->string('varea', 100)->nullable()->comment('视频产地');
			$table->string('vyears', 20)->nullable()->comment('视频年代');
			$table->integer('episode')->nullable()->default(1)->comment('排序集数 第几集');
			$table->integer('upto')->nullable()->comment('更新到');
			$table->integer('status')->default(0)->comment('媒资审核状态:0 未审核  1 已审核');
			$table->integer('deleted_at')->nullable()->comment('删除标记');
			$table->unique(['spid','asset_type','spasset_id','spassetkit_id'], 'spid');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
        Schema::drop('assets');
	}

}
